<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>JSON字符串转js对象，js对象转JSON字符串。</title>
	</head>
	<body>
		<script type="text/javascript">
			var str = '{"name": "嫉妒", "age": 18}'
			// JSON.parse() 将字符串转换为对象
			var obj = JSON.parse(str)
			console.log(obj)
			
			// JSON.stringify() 将对象转换为字符串
			var str = JSON.stringify(obj)
			console.log(str)
		</script>
	</body>
</html>
